<%- @creator.links.build if @creator.links.empty? # populate empty link %>
<%- @creator.caber_relations.build if @creator.caber_relations.empty? %>

<%= form_with model: @creator, class: "container-md tabular-form" do |form| %>
  <%= text_input_row form, :name %>
  <%= text_input_row form, :slug, help: t(".slug.help"), value: @attemped_slug || @creator.slug if @creator.slug.presence || !@creator.errors[:slug].empty? %>
  <%= render "links_form", form: form %>
  <%= text_input_row form, :caption %>
  <%= rich_text_input_row form, :notes, help: t(".notes.help_html") %>
  <%= select_input_row form, :indexable, indexable_select_options(form.object) %>
  <%= select_input_row form, :ai_indexable, ai_indexable_select_options(form.object) if SiteSettings.allow_ai_bots %>
  <%= file_input_row form, :avatar, help: "#{t(".avatar.help")} #{@creator.avatar ? t(".avatar.current", filename: @creator.avatar.metadata["filename"]) : t(".avatar.none")}", remove: @creator.avatar.present?, remove_label: t(".avatar.remove") %>
  <%= file_input_row form, :banner, help: "#{t(".banner.help")} #{@creator.banner ? t(".banner.current", filename: @creator.banner.metadata["filename"]) : t(".banner.none")}", remove: @creator.banner.present?, remove_label: t(".banner.remove") %>
  <%= render "caber_relations_form", form: form %>
  <div>
    <%= form.submit translate("general.save"), class: "btn btn-primary" %>
    <% if @creator.persisted? %>
      <span class="float-end">
        <%= DoButton(icon: "trash", label: t("general.delete"), href: creator_path(@creator), method: :delete, variant: "outline-danger", confirm: translate("creators.destroy.confirm")) if policy(@creator).destroy? %>
      </span>
    <% end %>
  </div>
<% end %>
